package com.nbsaas.boot.project.rest.resource;

import com.nbsaas.boot.jpa.data.core.BaseResource;
import com.nbsaas.boot.project.api.apis.ProjectTaskApi;
import com.nbsaas.boot.project.api.domain.request.ProjectTaskRequest;
import com.nbsaas.boot.project.api.domain.response.ProjectTaskResponse;
import com.nbsaas.boot.project.api.domain.simple.ProjectTaskSimple;
import com.nbsaas.boot.project.data.entity.ProjectTask;
import com.nbsaas.boot.project.data.repository.ProjectTaskRepository;
import com.nbsaas.boot.project.rest.convert.ProjectTaskEntityConvert;
import com.nbsaas.boot.project.rest.convert.ProjectTaskResponseConvert;
import com.nbsaas.boot.project.rest.convert.ProjectTaskSimpleConvert;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.function.Function;
/**
 *   项目任务-业务接口实现
 */
@Transactional
@Service
public class ProjectTaskResource extends BaseResource<ProjectTask, ProjectTaskResponse, ProjectTaskSimple, ProjectTaskRequest> implements ProjectTaskApi {

    @Resource
    private ProjectTaskRepository projectTaskRepository;

    @Override
    public JpaRepositoryImplementation<ProjectTask, Serializable> getJpaRepository() {
        return projectTaskRepository;
    }

    @Override
    public Function<ProjectTask, ProjectTaskSimple> getConvertSimple() {
        return new ProjectTaskSimpleConvert();
    }

    @Override
    public Function<ProjectTaskRequest, ProjectTask> getConvertForm() {
        return new ProjectTaskEntityConvert();
    }

    @Override
    public Function<ProjectTask, ProjectTaskResponse> getConvertResponse() {
        return new ProjectTaskResponseConvert();
    }


}


